﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using WpfAppPrismT1.Services;

namespace WpfAppPrismT1;

public partial class App
{
    /// <summary>
    /// 在这里注册的服务，通过 ServiceProvider 和 AppContainer 都可以拿到
    /// </summary>
    /// <param name="services"></param>
    private static void ConfigureServicesBeforeAppLaunch(IServiceCollection services)
    {
        services.AddSingleton(_ => Current.Dispatcher);
        services.AddSingleton<IMyService, MyService>();
    }

    /// <summary>
    /// 在这里注册的服务，只能通过 AppContainer 拿到
    /// </summary>
    /// <param name="services"></param>
    private void ConfigureServicesWhenAppLaunch(IServiceCollection services)
    {
        // 在这里注册的服务，只能通过 AppContainer 拿到
        // services.AddSingleton<IMyService, MyService>();
    }
}
